package com.inetools.gwt.gajaxs.client;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

/**
 * Model (JavaScriptObject) class for data returned by event kind service of google data API
 * Refer to the followings:
 * 	http://code.google.com/apis/gdata/docs/2.0/reference.html#DocumentFormat
 * 	http://code.google.com/apis/gdata/docs/2.0/elements.html#gdEventKind
 * @author ay
 */
public class GDataEventKindFeedData extends GDataFeedModel {
	protected GDataEventKindFeedData() {
		super();
	}
	
	// Class definitions for sub elements of entry element ----------------------------------------
	public static class EntryWhere extends JavaScriptObject {
		protected EntryWhere() {
		}
		
		public final native String getValueString() /*-{
			return this.valueString;
		}-*/;
	} // public static class EntryWhere extends JavaScriptObject
	public static class EntryWho extends JavaScriptObject {
		protected EntryWho() {
		}
		
		public final native String getEmail() /*-{
			return this.email;
		}-*/;
		public final native String getRel() /*-{
			return this.rel;
		}-*/;
		public final native String getValueString() /*-{
			return this.valueString;
		}-*/;
	} // public static class EntryWho extends JavaScriptObject
	public static class EntryWhen extends JavaScriptObject {
		protected EntryWhen() {
		}
		
		public final native String getStartTime() /*-{
			return this.startTime;
		}-*/;
		public final native String getEndTime() /*-{
			return this.endTime;
		}-*/;
	} // public static class EntryWhen extends JavaScriptObject
	// --------------------------------------------------------------------------------------------
	
	public static class GDEventEntry extends GDataFeedModel.GDEntry {
		protected GDEventEntry() {
			super();
		}
		
		// ----------------------------------------------------------------------------------------
		// Refer to http://code.google.com/apis/gdata/docs/2.0/elements.html#gdEventKind
		public final native String getCommentsFeedLink() /*-{
			return this.gd$comments.gd$feedLink.href;
		}-*/;
		public final native String getEventStatus() /*-{
			return this.gd$eventStatus.value;
		}-*/;
		public final native JsArray<EntryWhere> getWhereArray() /*-{
			return this.gd$where;
		}-*/;
		/**
		 * @return null when value of projection in request URL is full-noattendees 
		 */
		public final native JsArray<EntryWho> getWhoArray() /*-{
			if ( this.gd$who) return this.gd$who;
			else return null;
		}-*/;
		public final native JsArray<EntryWhen> getWhenArray() /*-{
			return this.gd$when;
		}-*/;
		public final native String getTransparency() /*-{
			return this.gd$transparency.value;
		}-*/;
		// ----------------------------------------------------------------------------------------
	}	
	
	// Data API Entry Schema element
	public final native JsArray<GDEventEntry> getGDEventEntries() /*-{
		return this.feed.entry;
	}-*/;
}
